package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.AllianceConfirmDetail;
import com.eling.elcms.travel.service.IAllianceConfirmDetailManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class AllianceConfirmDetailController extends BaseFormController{

	@Autowired
	private IAllianceConfirmDetailManager allConfDetManager;
	
	@RequestMapping("/api/allianceconfirmdetail/save")
    @ResponseBody
	public AllianceConfirmDetail save(@ModelAttribute@ModelFilling AllianceConfirmDetail cond){
		return allConfDetManager.save(cond);
	}
	
	@RequestMapping("/api/allianceconfirmdetail/{pkAllianceConfirmDetail}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkAllianceConfirmDetail){
		allConfDetManager.remove(pkAllianceConfirmDetail);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/allianceconfirmdetail/query")
    @ResponseBody
	public List<AllianceConfirmDetail> query(@ModelAttribute AllianceConfirmDetail cond){
		return allConfDetManager.query(cond);
	}
	
	@RequestMapping("/api/allianceconfirmdetail/search*")
	@ResponseBody
	public List<AllianceConfirmDetail> search(@ModelAttribute SearchCondition sc,@ModelAttribute AllianceConfirmDetail cond){
		sc.setQueryCondition(cond);
		return allConfDetManager.search(sc);
	}
	
}
